define [
  'chaplin'
  'views/base/item_view'
  'text!templates/movimento/item.html'
  'lib/enums'
  'lib/number_utils'
  'daos/movimento_dao'
], (Chaplin, ItemView, template, Enums, NumberUtils, MovimentoDao) ->

  'use strict'

  class MovimentoItemView extends ItemView

    # Override Attributtes
    # =============================================================
    template: template

    initialize: (options={}) ->
      _(@).extend options
      super

    getTemplateData: ->
    	_.extend super,
        operacao : Enums.tipoOperacao[@model.get('operacao')]
        valor    : @setDecimal(@model.get('valor'))

    setDecimal: (val) ->
      if val
        return NumberUtils.number_format(val, 2, ',', '.')
      else
        return '0,00'

    fixDecimal: (val='') ->
      return val.replace(/\./g, '').replace ',', '.'


